﻿using System.Web.UI;

namespace EBAYVN.Controls
{
    [ToolboxData("<{0}:Button runat=server></{0}:Button>")]
    public class Button : System.Web.UI.WebControls.Button
    {
        public enum TYPE
        {
            WAITING = 1,
            MODALDIALOG = 2
        }

        public TYPE DialogType { get; set; }
        public string DialogTitle { get; set; }
        public int DialogWidth { get; set; }
        public string DialogDivContainer { get; set; }

        public override string OnClientClick
        {
            get
            {
                return DialogType == TYPE.MODALDIALOG ? 
                    string.Format("openDialogAndBlock('{0}', {1}, '{2}');", DialogTitle, DialogWidth, DialogDivContainer) : 
                    "return doPostBack(this);";
            }
            set { base.OnClientClick = value; }
        }

        public override bool UseSubmitBehavior
        {
            get { return false; }
            set { base.UseSubmitBehavior = value; }
        }

        public override bool CausesValidation
        {
            get { return false; }
            set { base.CausesValidation = value; }
        }
    }
}
